package com.liuhm.exception;

/**
 * 异常基类
 *
 * @author lijian
 * @date 2018年8月21日13:47:11
 */

public class BaseException extends RuntimeException {
    private static final long serialVersionUID = -7931860051186657254L;

    protected Integer code;
    protected String msg;

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public BaseException() {
        super();
    }

    public BaseException(Integer code, String msg) {
        super(msg);
        this.code = code;
        this.msg = msg;
    }


    public BaseException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
    }

    public BaseException(String message, Throwable cause) {
        super(message, cause);
    }

    public BaseException(String message) {
        super(message);
    }

    public BaseException(Throwable cause) {
        super(cause);
    }

    /**
     * 重写fillInStackTrace 业务异常不需要堆栈信息，提高效率.
     *
     * @see Throwable#fillInStackTrace()
     */
    @Override
    public Throwable fillInStackTrace() {
        return this;
    }

    /**
     * fillInStackTrace
     *
     * @return
     */
    public Throwable doFillInStackTrace() {
        return super.fillInStackTrace();
    }
}
